package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class IODemo11 {
    public static void main(String[] args) {
        try(InputStream inputStream = new FileInputStream("./aaa/test1.txt")){
            while(true){
                byte[] b = new byte[1024];
                int n = inputStream.read(b);
                if(n == -1){
                    break;
                }
                for(int i = 0; i < n; i++){
                    System.out.printf("0x%x ", b[i]);
                }
            }

        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
